<style lang="scss">
  @import "../utils/base.scss";
    .left_style2{
        height:calc(100vh - 144px);
        width: 200px;
        overflow-y: auto;
        border-right: 2px solid rgb(240,240,240);
        float:left;
        z-index: 99;
    }
    .right_style{
        height:calc(100vh - 144px);
        overflow-y: auto;
    }
    .a{
        font-size: 16px;
        color: #515A6E;
        font-weight: bold;
    }
    .button{
        width: 60px;
        height: 25px;
        // float:left;
    }
    .form.ivu-form .ivu-form-item-label{
      font-size: 13px;
    }
    .form_left{
        padding-left: 40px;
    }
    .Col_height{
        height:40px;
    }

    .qheader{
      font-size: 14px;
      height: 58px;
      font-weight:bold;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-left: 15px;
    }
    .gcontent{
      font-size: 13px;
      padding:10px;
      margin-bottom: 10px;

    };
    .ivu-list-split .ivu-list-item:last-child:hover{
        background-color: #f0faff;
    }

    .ivu-btn{
        font-size: 13px;
    }
    .a{
        font-size: 13px;
    }

    .wait{
        display: block;
        width: 26px;
        height: 26px;
        line-height: 24px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 50%;
        font-size: 14px;
        transition: background-color 0.2s ease-in-out;
        border-color: #2d8cf0;
        background-color: #2d8cf0;
    }
    .wait1{
        display: block;
        width: 26px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 50%;
        font-size: 14px;
        transition: background-color 0.2s ease-in-out;
        border-color: #2d8cf0;
        background-color: white;

    }
    .wait2{
        display: block;
        width: 26px;
        height: 26px;
        line-height: 24px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 50%;
        font-size: 14px;
        color: #2d8cf0;
        transition: background-color 0.2s ease-in-out;
        background-color: #fff;
        border-color: #2d8cf0;
    }
    .wait3 {
        display: block;
        width: 26px;
        height: 26px;
        line-height: 24px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 50%;
        font-size: 14px;
        transition: background-color 0.2s ease-in-out;
    }
    .wait_children{
      border-radius: 50%;
      width: 16px;
      height: 16px;
      line-height: 15px;
      font-size: 10px;
      left: 4px;
      position: relative;
    }
    .wait2Span:before{
        content: "\F171";
    }
    .wait2Span{
        font-size: 24px;
        color: #2d8cf0;
    }
    .ivu-steps-vertical .ivu-steps-custom .ivu-steps-icon{
        left: 0px;
    }
    .ivu-steps-item.ivu-steps-custom .ivu-steps-head-inner > .ivu-steps-icon{
        top: 0px;
    }
    .header_info{
        width: 10px;
        border-bottom: 2px solid #5ea2d6;
    }
    .ivu-steps-vertical .ivu-steps-main{
        min-height: 40px;
    }
    .ivu-steps-vertical .ivu-steps-tail{
      left: 12px;
    }
  .demo-badge{
      width: 58px;
      height: 58px;
      background: #fff;
      border: 1px solid rgb(230,230,230);
      border-radius: 6px;
      display: inline-block;
      text-align:center;
  }
  .tale{
      word-wrap: break-word;
      word-break: break-all;
      border-collapse:collapse;
      border:1px solid #dcdee2;
      font-size:14px;
      height: 50px;
      width: 100%;
  }
  .tale_title{
      height: 40px;
      background-color: #F2F2F2;
      font-weight:bold;
  }
  td.ivu-table-expanded-cell {
      background-color: #ffffff;
  }
  .step_down{
    color:black;
    position: absolute;
    top: 8px;
    right: 0px;
  }
  .step_down:hover{
    cursor: pointer;
  }
  .complaint_td{
    padding: 4px;
  }
  .vLine {
      border-left: dashed 2px #FFC300;
      height: 32px;
      vertical-align: middle;
      display: inline-block;
  }
</style>
<template>
  <div>
    <pheader style="border-bottom: 1px solid rgb(240,240,240);">

      <div slot="left">
        <Button @click="closeHandlePage()" style="color: #2d8cf0;">
          <Icon type="md-arrow-round-back" style="font-size: 15px;padding-right:8px;line-height: 8px;" />返回
        </Button>
        <span style="padding-left:12px">工单详情{{title}}</span>
      </div>

      <div slot="right" style="float:right;margin-right: 20px;position: relative;">
        <!-- 				<Button v-if="serviceType === 'entry'" type="primary" @click="$refs.apply.exportResource()">导出资源</Button>
				<Button v-if="serviceType === 'entry'" type="primary" @click="$refs.apply.exportData()">导出数据目录</Button> -->
        <Dropdown @on-click="selectExport" v-if="serviceType === 'entry' || serviceType === 'entry_v2'">
          <Button type="primary">
            导出操作
            <Icon type="ios-arrow-down"></Icon>
          </Button>
          <DropdownMenu slot="list">
            <DropdownItem name="0">导出资源信息</DropdownItem>
            <DropdownItem name="1">导出数据目录</DropdownItem>
            <DropdownItem name="2">导出账号IP信息</DropdownItem>
          </DropdownMenu>
        </Dropdown>
        <Dropdown @on-click="selectAccountExport" v-if="serviceType === 'accountNoBigdata' || serviceType === 'accountBigdata'">
          <Button type="primary">
            导出账号信息
            <Icon type="ios-arrow-down"></Icon>
          </Button>
          <DropdownMenu slot="list">
            <DropdownItem name="0">所有账号信息</DropdownItem>
            <DropdownItem name="1">主机账号信息</DropdownItem>
          </DropdownMenu>
        </Dropdown>
        <Button v-if="waitTasks.isPrint  == '1'  || ((serviceType === 'entry' || serviceType === 'entry_v2')  && taskDefKey==='_04') || (serviceType === 'hightAuthoritys' && taskDefKey === '_03') || (serviceType === 'accountNoBigdata') "
          type="primary" @click="isPrint = true">打印</Button>
        <Button v-if="serviceType === 'net'" type="primary"    @click="downLoadNetwork">导出表单</Button>
        <!-- <Button v-if="serviceType === 'accountNoBigdata' || serviceType === 'accountBigdata'" style="width: auto;" @click="exportAccount()">导出账号信息</button> -->
        <Button v-if="processInfo.parentReqId != -1" style="width: auto;" @click="toParent()">查看主工单信息</button>

        <!-- dispose:是否允许处理 && serviceType === 'entry'-->
        <Button v-if="processInfo.dispose == 1 && (isEdit == 1 || isEdit == 23)" type="primary" @click="editStatus">{{ifedit ?'编辑':'取消'}}</Button>
        <template v-if="processInfo.dispose == 1 && (isEdit == 1 || isEdit == 23)&& !ifedit ">
          <Button v-if="serviceType === 'register'" @click="saveRegister">保存</Button>
          <Button v-else @click="saveContent">保存</Button>
          <div class="vLine"></div>
        </template>

        <Button v-if="processInfo.dispose == 1" type="primary" @click="showHandlePage">处理</Button>
        <Button v-if="processInfo.dispose == 1 && waitTasks.opSons != undefined && waitTasks.opSons.length > 0" type="primary"
          @click="toShowChildrenList">发起子工单</Button>
        <Button type="primary" @click="showActivitiInfo = true">任务处理概览</Button>
        <Spin size="large" fix v-if="loadingdownLoadNetwork" style="font-size: 10px">正在导出列表...</Spin>
      </div>
    </pheader>
    <div style="position: relative;" >
      <div class="quest_content" style="padding-left:15px;padding-right: 0px;height:calc(100vh - 144px);">
        <div class="left_style2">
          <!-- <Steps :current="doneAllTaskKey.length" direction="vertical" style="padding:15px 15px"> -->
          <Steps :current="TaskNodes.count" direction="vertical" style="padding:15px 15px">
            <Step>
              <template slot="title">
                <a href="javascript:void(0)" class="a" @click="toScroll('baseinfo')" style="padding-left: 5px;">基本信息</a>
              </template>
            </Step>

            <template v-if="!utils.listIsEmpty(TaskNodes.list)" v-for="(item, Stepindex) in TaskNodes.list">
              <Step>
                <template slot="icon">
                  <div class="wait2" v-if="item.status == 1">
                    <Icon type="ios-checkmark" size="24" />
                  </div>
                  <div class="wait3" v-else-if="item.status == 2"><span style="color: #ccc;">{{Stepindex+2 }}</span></div>
                  <template v-else-if="waitTaskKey != '' && item.status == 0">
                    <div v-if="waitTaskKey === item.taskDefKey" class="wait"><span style="color: white;">{{Stepindex+2}}</span></div>
                    <div v-else class="wait1"><span style="color: #2d8cf0;">{{Stepindex+2}}</span></div>
                  </template>
                  <div v-else class="wait"><span style="color: white;">{{Stepindex+2 }}</span></div>
                </template>

                <template slot="title">
                  <div v-if="(doneAllTaskKey.indexOf(item.taskDefKey) != -1 || waitAllTaskKey.indexOf(item.taskDefKey) != -1) && item.status != 2">
                    <a href="javascript:void(0)" class="a" @click="toScroll(item.name)" style="padding-left: 4px;">{{item.name}}</a>
                  </div>
                  <div v-else-if="!utils.listIsEmpty(item.children) && item.status != 2 ">
                    <span style="font-size: 13px;color: #515A6E;padding-left: 4px;">{{item.name}}</span>
                  </div>
                  <div v-else>
                    <p style="font-size: 13px;color:#999;padding-left: 4px;">{{item.name}}</p>
                  </div>
                  <Icon v-if="!utils.listIsEmpty(item.children) && !item.check" @click="setStepDomn(Stepindex)" type="ios-arrow-down"
                    class="step_down" />
                  <Icon v-if="!utils.listIsEmpty(item.children) && item.check" @click="setStepDomn(Stepindex)" type="ios-arrow-up"
                    class="step_down" />
                </template>
              </Step>
              <template v-if="!utils.listIsEmpty(item.children) && item.check" v-for="(item2, Stepindex2) in item.children">
                <Step>
                  <template slot="icon">
                    <div class="wait2 wait_children" v-if="item2.status == 1">
                      <Icon type="ios-checkmark" size="15" />
                    </div>
                    <div class="wait3 wait_children" v-else-if="item2.status == 2">
                      <span style="color: #ccc;">{{Stepindex2+1 }}</span>
                    </div>
                    <template v-else-if="waitTaskKey != '' && item2.status == 0">
                      <div v-if="waitTaskKey === item2.taskDefKey" class="wait" style="border-radius: 50%;width: 16px;height: 16px;line-height: 15px;font-size: 10px;left: 4px; position: relative;">
                        <span style="color: white;">{{Stepindex2+1}}</span>
                      </div>
                      <div v-else class="wait1" style="border-radius: 50%;width: 16px;height: 16px;line-height: 15px;font-size: 10px;left: 4px; position: relative;">
                        <span style="color: #2d8cf0;">{{Stepindex2+1}}</span>
                      </div>
                    </template>
                    <div v-else class="wait" style="border-radius: 50%;width: 16px;height: 16px;line-height: 15px;font-size: 10px;left: 4px; position: relative;">
                      <span style="color: white;">{{Stepindex2+1 }}</span>
                    </div>
                  </template>

                  <template slot="title">
                    <div v-if="(doneAllTaskKey.indexOf(item2.taskDefKey) != -1 || waitAllTaskKey.indexOf(item2.taskDefKey) != -1) && item2.status != 2"
                      style="line-height: 15px;">
                      <a href="javascript:void(0)" class="a" @click="toScroll(item2.name)" style="font-size: 13px;padding-left: 13px;">{{item2.name}}</a>
                    </div>
                    <div v-else style="line-height: 15px;">
                      <p style="font-size: 13px;color:#999;padding-left: 13px;">{{item2.name}}</p>
                    </div>
                  </template>
                </Step>
              </template>

            </template>
          </Steps>
        </div>
        <div class="right_style" ref='base' v-if="!loadingSpin">
          <div>
            <div id="baseinfo" name="baseinfo">
              <div class="qheader" style="border-bottom: 1px solid rgb(210,210,210);">
                <div style="background-color:#2d8cf0;">
                  <div style="padding-left: 5px;margin-left: 3px;background-color:#fff;">
                    <p>工单信息</p>
                  </div>
                </div>
              </div>
              <div class="gcontent">
                <component v-model="isPrint" :key="updateComponents" ref="apply" :is="infoPage" :ifedit.sync="ifedit"
                  :isEdit="isEdit" :processInfo="processInfo" :reqId="reqId" :ishidden="true" :childrenType="taskDefKey"
                  :serviceType="processInfo.serviceType"></component>
              </div>
            </div>
            <!-- 已处理 -->
            <template v-for="(item,index) in processInfo.doneTasks">
              <div :key="index" :id="item.taskName" class="qheader" :name="item.taskName" style="border-bottom: 1px solid rgb(210,210,210);">
                <div style="background-color:#2d8cf0;">
                  <div style="padding-left: 5px;margin-left: 3px;background-color:#fff;">
                    <div>{{item.taskName}}<span style="font-size:14px;">(已处理)</span></div>
                  </div>
                </div>
              </div>
              <div class="gcontent">
                <Form :label-width="140" label-position="left" class="form form_left">
                  <Row>
                    <Col span="8" class="Col_height">
                    <FormItem label="节点处理人:">
                      <Input v-model="item.userName" :readonly="readonly" />
                    </FormItem>
                    </Col>
                    <Col span="8" class="col_left Col_height">
                    <FormItem label="是否超时:">
                      <Input :value="item.isOverTime == 1?'是':'否'" :readonly="readonly" />
                    </FormItem>

                    </Col>

                  </Row>
                  <Row>
                    <Col span="8" class="Col_height">
                    <FormItem label="开始时间:">
                      <Input :value="item.startTime.substring(0,19)" :readonly="readonly"></Input>
                    </FormItem>
                    </Col>
                    <Col span="8" class="col_left Col_height">
                    <FormItem label="结束时间:">
                      <Input :value="item.endTime.substring(0,19)" :readonly="readonly" />
                    </FormItem>
                    </Col>
                  </Row>
                  <Row>
                    <Col span="22" style="width:96.666667%">
                    <FormItem label="处理意见:">
                      <Input v-model="item.message" type="textarea" :autosize="{minRows: 4,maxRows: 6}" :readonly="readonly" />
                    </FormItem>
                    </Col>
                  </Row>
                  <template v-if="item.files.length > 0">
                    <Row>
                      <Col span="22" class="Col_height">
                      <FormItem label="附件:">
                        <component ref="fileDownload" :is="'fileDownload'" :files="item.files"></component>
                      </FormItem>
                      </Col>
                    </Row>
                  </template>
                  <!-- 委派信息 -->
                  <div v-if="item.delegateList.length > 0 && item.delegateList[0] != null">
                    <Row>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;">
                      转派信息:
                      </Col>
                      <Col span="24" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                      <table border="1px" class="tale">
                        <tr align="center" class="tale_title">
                          <td style="width: 10%;"></td>
                          <td style="width: 20%;">姓名</td>
                          <td style="width: 30%;">处理时间</td>
                          <td>处理信息</td>
                        </tr>
                        <tr align="center">
                          <td>
                            委派人
                          </td>
                          <td>
                            {{item.delegateList[0].assign}}
                          </td>
                          <td>
                            {{formatTime(item.delegateList[0].start_time)}}
                          </td>
                          <td>
                            {{item.delegateList[0].message}}
                          </td>
                        </tr>
                        <template v-for="(i,index) in item.delegateList">
                          <tr align="center" v-if="index != 0" :key="index">
                            <td>
                              被委派人
                            </td>
                            <td>
                              {{i.assign}}
                            </td>
                            <td>
                              {{formatTime(i.start_time)}}
                            </td>
                            <td>
                              {{i.message}}
                            </td>
                          </tr>
                        </template>
                      </table>
                      </Col>
                    </Row>
                  </div>
                  <div v-if="item.complaintList != null && item.complaintList.length > 0 && item.complaintList[0] != null">
                    <Row>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;">
                      转办信息:
                      </Col>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                      <table border="1px" class="tale">
                        <tr align="center" class="tale_title">
                          <td style="width: 10%;">类型</td>
                          <td style="width: 10%;">转办人员</td>
                          <td style="width: 15%;">开始时间</td>
                          <td style="width: 15%;">处理时间</td>
                          <td style="width: 5%;">是否超时</td>
                          <td style="width: 35%;">执行处理意见</td>
                          <td>附件</td>
                        </tr>
                        <template v-for="(i,index) in item.complaintList">
                          <tr align="center" :key="index" style="height: 40px;">
                            <td class="complaint_td">
                              {{i.typeName}}
                            </td>
                            <td class="complaint_td">
                              {{i.assign}}
                            </td>
                            <td class="complaint_td">
                              {{formatTime(i.start_time)}}
                            </td>
                            <td class="complaint_td">
                              {{i.end_time != undefined && i.end_time != null ? formatTime(i.end_time): ""}}
                            </td>
                            <td class="complaint_td">
                              {{i.isOverTime == 1?'是':'否'}}
                            </td>
                            <td class="complaint_td">
                              {{i.message}}
                            </td>
                            <td class="complaint_td">
                              <fileDownload2 v-if="i.files != undefined && i.files != null && i.files.length > 0"
                                :files="i.files"></fileDownload2>
                            </td>
                          </tr>
                        </template>
                      </table>
                      </Col>
                    </Row>
                  </div>
                  <!-- 子工单 -->
                  <Row v-if="item.sons.length > 0">
                    <Col span="22" style="width:96.666667%;padding-bottom: 10px">
                    子工单:
                    </Col>
                    <Col span="24" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                    <Table border :columns="sonsColumns" :data="item.sons" @on-row-dblclick="sonsInfo" size="small">
                      <template slot-scope="{ row, index }" slot="startTime">
                        <span>{{formatDate(row.startTime)}}</span>
                      </template>
                      <template slot-scope="{ row, index }" slot="action">
                        <Button type="warning" size="small" style="margin-right: 5px" @click="sonsInfo(row, index)">查看</Button>
                      </template>
                      <template slot-scope="{ row, index }" slot="status">
                        <p> {{row.status == 0 ? '关闭':(row.status == 1?'进行中':(row.status == 2?'已完成': '退回'))}}</p>
                      </template>
                    </Table>
                    </Col>
                  </Row>
                  <!-- 资源分配 -->
                  <div v-if="(item.isEdit == 16 || item.isEdit == 17 || item.isEdit == 15 || item.isEdit == 5 || item.isEdit == 6 || item.isEdit == 7 || item.isEdit == 8 || item.isEdit == 13 )&& (serviceType === 'entry' || serviceType === 'entry_v2' || serviceType === 'severMachine')">
                    <template v-if="item.isEdit == 16">
                      <template v-for="item0 in dataInfoChange">
                        <div v-if="item0.taskId == item.task_id">
                          <component ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="true"
                            :dataInfo="item0" :waitTaskInfo="item" :serviceType="serviceType"></component>
                        </div>
                      </template>
                    </template>
                    <template v-else-if="item.isEdit == 17">
                      <template v-for="item0 in allDataInfo">
                        <component ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="true"
                          :dataInfo="item0" :waitTaskInfo="item" :serviceType="serviceType"></component>
                      </template>
                    </template>
                    <component v-else ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="true"
                      :dataInfo="dataInfo" :waitTaskInfo="item" :serviceType="serviceType"></component>
                  </div>

                  <div v-if="serviceType === 'vip' && item.isEdit == 4" style="width:97%">
                       <div style="margin-bottom:1rem" v-for="(item, index) in objList" :key="index">
                        <vipTable ref="vipTable" v-model="objList[index]" :ifedit="ifedit" :ifShow="true"  :vipObject="vipObject[index]"></vipTable>
                      </div>
                    <!-- <vipTable ref="vipTable" v-model="ipObject" :ifedit="ifedit" :ifShow="true" :vipObject="vipObject"></vipTable> -->
                  </div>
                </Form>
              </div>
            </template>
            <!-- 待处理 -->
            <template v-for="item in processInfo.waitTasks">
              <div :id="item.taskName" class="qheader" :name="item.taskName" style="border-bottom: 1px solid rgb(210,210,210);">
                <div style="background-color:#2d8cf0;">
                  <div style="padding-left: 5px;margin-left: 3px;background-color:#fff;">
                    <div>{{item.taskName}}<span style="font-size:14px;color:#bbb">(待处理)</span></div>
                  </div>
                </div>
              </div>
              <div class="gcontent">
                <Form :label-width="140" label-position="left" class="form form_left">
                  <Row>
                    <Col span="8" class="Col_height">
                    <FormItem label="节点处理人:">
                      <Input v-model="item.userName" :readonly="readonly" />
                    </FormItem>
                    </Col>
                    <Col span="8" class="col_left Col_height">
                    <FormItem label="是否超时:">
                      <Input :value="item.isOverTime == 1?'是':'否'" :readonly="readonly" />
                    </FormItem>
                    </Col>
                  </Row>
                  <Row>
                    <Col span="8" class="Col_height">
                    <FormItem label="开始时间:">
                      <Input :value="item.startTime.substring(0,19)" :readonly="readonly" />
                    </FormItem>
                    </Col>
                    <Col span="8" class="col_left Col_height">
                    <FormItem label="结束时间:">
                      <Input :readonly="readonly" />
                    </FormItem>
                    </Col>
                  </Row>
                  <!-- 资源分配 -->
                  <div v-if="item.isEdit == 16 || item.isEdit == 17 || item.isEdit == 15 || isEdit == 5 || isEdit == 6 || isEdit == 7 || isEdit == 8 || isEdit == 13 || serviceType === 'entry' || serviceType === 'entry_v2' || serviceType === 'severMachine'">
                    <template v-if="item.isEdit == 16">
                      <template v-for="item0 in dataInfoChange">
                        <div v-if="item0.taskId == item.taskId">
                          <component ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="isEdit == 6 || isEdit == 8 || item.task_def_key =='_08' || item.task_def_key =='_10' || item.task_def_key =='_16'? true:false"
                            :dataInfo="item0" :waitTaskInfo="item" :editNumber="false" :serviceType="serviceType"></component>
                        </div>
                      </template>
                    </template>
                    <template v-else-if="item.isEdit == 17">
                      <template v-for="item0 in allDataInfo">
                        <component ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="isEdit == 6 || isEdit == 8 || item.task_def_key =='_08' || item.task_def_key =='_10' || item.task_def_key =='_16'? true:false"
                          :dataInfo="item0" :waitTaskInfo="item" :editNumber="false" :serviceType="serviceType"></component>
                      </template>
                    </template>
                    <component v-else ref="resourceInfo" :is="'resourceInfo'" :isEdit="isEdit" :handleInfo="isEdit == 6 || isEdit == 8 || item.task_def_key =='_08' || item.task_def_key =='_10' || item.task_def_key =='_16'? true:false"
                      :dataInfo="dataInfo" :waitTaskInfo="item" :editNumber="false" :serviceType="serviceType"></component>
                  </div>
                  <!-- 委派信息 -->
                  <div v-if="item.delegateList.length > 0 && item.delegateList[0] != null">
                    <Row>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;">
                      转派信息:
                      </Col>
                      <Col span="24" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                      <table border="1px" class="tale">
                        <tr align="center" class="tale_title">
                          <td style="width: 10%;"></td>
                          <td style="width: 20%;">姓名</td>
                          <td style="width: 30%;">处理时间</td>
                          <td>处理信息</td>
                        </tr>
                        <tr align="center">
                          <td>
                            委派人
                          </td>
                          <td>
                            {{item.delegateList[0].assign}}
                          </td>
                          <td>
                            {{formatTime(item.delegateList[0].start_time)}}
                          </td>
                          <td>
                            {{item.delegateList[0].message}}
                          </td>
                        </tr>
                        <template v-for="(i,index) in item.delegateList">
                          <tr align="center" v-if="index != 0" :key="index">
                            <td>
                              被委派人
                            </td>
                            <td>
                              {{i.assign}}
                            </td>
                            <td>
                              {{formatTime(i.start_time)}}
                            </td>
                            <td>
                              {{i.message}}
                            </td>
                          </tr>
                        </template>
                      </table>
                      </Col>
                    </Row>
                  </div>
                  <!-- 转办 -->
                  <div v-if="item.complaintList != null && item.complaintList.length > 0 && item.complaintList[0] != null">
                    <Row>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;">
                      转办信息:
                      </Col>
                      <Col span="24" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                      <table border="1px" class="tale">
                        <tr align="center" class="tale_title">
                          <td style="width: 10%;">类型</td>
                          <td style="width: 10%;">转办人员</td>
                          <td style="width: 15%;">开始时间</td>
                          <td style="width: 15%;">处理时间</td>
                          <td style="width: 5%;">是否超时</td>
                          <td style="width: 35%;">执行处理意见</td>
                          <td>附件</td>
                        </tr>
                        <template v-for="(i,index) in item.complaintList">
                          <tr align="center" :key="index" style="height: 40px;">
                            <td class="complaint_td">
                              {{i.typeName}}
                            </td>
                            <td class="complaint_td">
                              {{i.assign}}
                            </td>
                            <td class="complaint_td">
                              {{formatTime(i.start_time)}}
                            </td>
                            <td class="complaint_td">
                              {{i.end_time != undefined && i.end_time != null ? formatTime(i.end_time): ""}}
                            </td>
                            <td class="complaint_td">
                              {{i.isOverTime == 1?'是':'否'}}
                            </td>
                            <td class="complaint_td">
                              {{i.message}}
                            </td>
                            <td class="complaint_td">
                              <fileDownload2 v-if="i.files != undefined && i.files != null && i.files.length > 0"
                                :files="i.files"></fileDownload2>
                            </td>
                          </tr>
                        </template>
                      </table>
                      </Col>
                    </Row>
                  </div>
                  <!-- 子工单 -->
                  <div v-if="item.sons.length > 0">
                    <Row>
                      <Col span="22" style="width:96.666667%;padding-bottom: 10px;">
                      子工单:
                      </Col>
                      <Col span="24" style="width:96.666667%;padding-bottom: 10px;padding-left: 20px">
                      <Table border :columns="sonsColumns" :data="item.sons" @on-row-dblclick="sonsInfo" size="small">
                        <template slot-scope="{ row, index }" slot="startTime">
                          <span>{{formatDate(row.startTime)}}</span>
                        </template>
                        <template slot-scope="{ row, index }" slot="action">
                          <Button type="warning" size="small" style="margin-right: 5px" @click="sonsInfo(row, index)">查看</Button>
                        </template>
                        <template slot-scope="{ row, index }" slot="status">
                          <p> {{row.status == 0 ? '关闭':(row.status == 1 ?'进行中':(row.status == 2?'已完成': '退回'))}}</p>
                        </template>
                      </Table>
                      </Col>
                    </Row>
                  </div>
                </Form>
              </div>
            </template>
          </div>

          <!-- 子工单 -->
          <Modal v-model="showChildrenList" @on-ok="showChildrenList = false" title="可选择的子工单" :mask-closable="false"
            footer-hide>
            <List v-for="(item,index) in waitTasks.opSons" :key="index">
              <a href="javascript:void(0)" @click="toChildrenPage(item)">
                <ListItem>
                  <ListItemMeta>
                    <template slot="title">
                      <p>{{(index + 1) + '、' + item.name}}</p>
                    </template>
                    <template slot="description">
                      <p style="text-indent:1.5em;">{{item.des}}</p>
                    </template>
                  </ListItemMeta>
                </ListItem>
              </a>
            </List>
          </Modal>
          <component ref="handelModal" :is="'handelModal'" v-model="showHandle" :isEdit="isEdit" :processInfo="processInfo"
            :serviceType="serviceType"></component>
          <component ref="activitiInfo" :is="'activitiInfo'" v-model="showActivitiInfo" :processInfo="processInfo"
            :serviceType="serviceType"></component>
        </div>
      </div>
      <Spin size="large" fix v-if="loadingSpin"></Spin>
    </div>
  </div>
</template>

<script>
  import ajax from "../ajax_util"
  import Axios from 'axios'

  import mcontainer from '../comp_chatter/mcontainer'
  import mheader from "../comp_chatter/mheader"
  import mpage from "../comp_chatter/mpage"

  import minfo from "../comp_chatter/minfo"
  import pheader from "../comp_chatter/pheader"
  import settLedInInfo from './applyVue/apply_settledIn.vue'
  import settLedInInfo_v2 from './applyVue/apply_settledIn_v2.vue'
  import children from "./applyVue/apply_children"
  import network from './applyVue/apply_network'
  import netmap from './applyVue/apply_netmapping'
  import accountApply from './applyVue/apply_number'
  import childrenResource from './applyVue/apply_children_resources'
  import serverPlatformApply from './applyVue/apply_server_platform'
  import serverApply from './applyVue/apply_server'
  import safe_apply from './applyVue/apply_safe'
  import activitiInfo from './handleVue/activiti_info'
  import fileDownload from '../base/file_download'
  import sonAccountAllo from './applyVue/apply_children_account'
  import loadbalancing from './applyVue/apply_loadbalancing'
  import sysauthority from './applyVue/apply_sys'
  import apply_accountCancel from './applyVue/apply_accountCancel'
  import fileUpload from '../base/file_uploader'
  import untils from "../utils/excel"
  import expandRow from './sonAccount_expand.vue';
  import handelModal from './handleVue/handel_modal'
  import resourceInfo from './handleVue/resource_info'
  import fileDownload2 from '../base/file_download2.vue'
  import register from '../comp_user/registered2'
  import vip from './applyVue/apply_vip'
  import addGold from './applyVue/apply_vault'
  import applysuggest from './applyVue/apply_suggest'
  import shrinkage from './applyVue/apply_shrink'
  import accountApply_old from './applyVue/apply_number_old'
  import noRealAccount from './applyVue/apply_noRealAccount'
  import vipTable from './applyVue/vip/vip_table'
  import wisdom from './applyVue/apply_wisdom.vue'
  export default {
    name: "handle",
    components: {
      mheader,
      mpage,
      mcontainer,
      minfo,
      pheader,
      handelModal,
      resourceInfo,
      settLedInInfo,
      settLedInInfo_v2,
      children,
      network,
      accountApply,
      childrenResource,
      serverPlatformApply,
      serverApply,
      safe_apply,
      sysauthority,
      activitiInfo,
      fileDownload,
      sonAccountAllo,
      loadbalancing,
      fileUpload,
      apply_accountCancel,
      untils,
      expandRow,
      fileDownload2,
      register,
      vip,
      addGold,
      netmap,
      applysuggest,
      shrinkage,
      accountApply_old,
      noRealAccount,
      vipTable,
      wisdom
    },
    data() {
      return {
        updateComponents: '', //更新子组件
        isPrint: false,
        loadingdownLoadNetwork: false,
        loadingSpinNumber: 0, // 异步请求数量
        loadingSpin: false, //页面加载中

        showActivitiInfo: false,
        waitAllTaskIndex: [], //等待处理的所有步骤
        waitAllTaskKey: [], //等待处理的步骤名称
        doneAllTaskKey: [], //已处理步骤key
        taskIndex: -1, //当前处理的步骤
        waitTaskKey: "", //当前处理的步骤key
        click: true,
        clickindex: "",
        ifedit: true,
        httpHeader: {
          Authorization: this.$store.state.token
        },
        fileUrl: this.CONFIG.file_url,
        title: "",
        tabs: {},
        infoPage: "", //要显示base基础信息组件
        serviceType: "", //工单类型
        readonly: true,
        showChildrenList: false,
        handleLoading: true,
        showHandle: false,
        handInfoPage: "", //要显示的申请页面
        reqId: 0, //工单id
        state: "", //工单状态
        taskDefKey: "", //"任务节点ID"
        taskId: "", //任务id
        sonsColumns: [{
            title: '子工单类型',
            key: 'processName',
            width: 160,
            align: 'center'
          },
          {
            title: '发起人姓名',
            key: 'oriUserName',
            width: 120,
            align: 'center'
          },
          {
            title: '说明',
            minWidth: 160,
            key: 'reqDes',
            align: 'center'
          },
          {
            title: '发起时间',
            key: 'startTime',
            align: 'center',
            width: 160,
            slot: "startTime"
          },
          {
            title: '当前处理人',
            key: 'operator',
            align: 'center',
            width: 120,
          },
          {
            title: '状态',
            key: 'status',
            align: 'center',
            width: 90,
            slot: "status"
          },
          {
            title: '操作',
            align: 'center',
            width: 90,
            slot: "action"
          }
        ],
        handleName: [],
        filesList: [],
        operation: "",
        handleInfo: {
          reqId: "",
          taskId: "",
          message: "",
          operation: "",
          nextOperator: {
            id: "",
            userName: ""
          },
          files: []
        },
        isDelegate: 0,
        columns: {
          resourceColumns: [{
              title: "资源类型",
              align: "center",
              width: 110,
              key: "clazz",
              fixed: 'left'
            },
            {
              title: "服务名称",
              align: "center",
              width: 110,
              key: "serviceName",
            },
            {
              title: "细分项名",
              align: "center",
              width: 100,
              key: "subName",
            },
            {
              title: "单位",
              align: "center",
              width: 80,
              key: "unit",
            },
            {
              title: '测算依据',
              key: 'purpose',
              minWidth: 140,
              align: 'center',
            },
            {
              title: "需求数量",
              align: "center",
              width: 80,
              key: "quantity",
            },
            {
              title: "已分配数量",
              align: "center",
              width: 80,
              key: "doneQuantity",
              slot: "doneQuantity"
            },
            {
              title: "正在分配数量",
              align: "center",
              width: 80,
              key: "doingQuantity",
              slot: "doingQuantity"
            },
            {
              title: "待分配数量",
              align: "center",
              width: 80,
              key: "waitQuantity",
              slot: "waitQuantity"
            },


          ],
          severColumns: [{
              title: "服务类型",
              align: "center",
              key: "severName",
              width: 90,
              fixed: 'left',
              slot: "severName",
            },
            {
              title: "操作系统",
              align: "center",
              key: "os",
              width: 90,
              // slot: "os"
            },
            {
              title: "raid方式",
              align: "center",
              children: [{
                  title: '系统盘',
                  align: 'center',
                  key: "sysRaid",
                  width: 80,
                  // slot: "sysRaid"
                },
                {
                  title: '数据盘',
                  align: 'center',
                  key: "dataRaid",
                  width: 80,
                  // slot: "dataRaid"
                },
              ]
            },
            {
              title: "部署区域",
              align: "center",
              key: "place",
              width: 90,
              // slot: "place"
            },

            {
              title: "测算依据/必要性说明",
              align: "center",
              key: "purpose",
              minWidth: 160,
              // slot: "purpose"
            },
            {
              title: "需求数量",
              align: "center",
              width: 80,
              key: "quantity",
            },
            {
              title: "已分配数量",
              align: "center",
              width: 80,
              key: "doneQuantity",
              slot: "doneQuantity"
            },
            {
              title: "正在分配数量",
              align: "center",
              width: 80,
              key: "doingQuantity",
              slot: "doingQuantity"
            },
            {
              title: "待分配数量",
              align: "center",
              width: 80,
              key: "waitQuantity",
              slot: "waitQuantity"
            },
            {
              title: " ",
              align: "center",
              width: 110,
              fixed: 'right',
              slot: "action"
            },
          ],
          toolColumns: {
            resourceColum: [{
                title: "资源类型",
                align: "center",
                // width: 180,
                key: "clazz",
              },
              {
                title: "服务名称",
                align: "center",
                // width: 120,
                key: "serviceName",
              },
              {
                title: "需求数量",
                align: "center",
                width: 120,
                key: "quantity",
                // slot: "quantity"
              },
              {
                title: "待分配数量",
                align: "center",
                width: 120,
                key: "quantity1",
              },
              {
                title: "分配数量",
                align: "center",
                width: 120,
                key: "quantity2",
              },

            ],
            severColumn: [{
                title: "服务器名称",
                align: "center",
                // width: 180,
                key: "severName",
              },
              {
                title: "需求数量",
                align: "center",
                width: 110,
                key: "quantity",
                // slot: "quantity"
              },
              {
                title: "待分配数量",
                align: "center",
                width: 110,
                key: "quantity1",
              },
              {
                title: "分配数量",
                align: "center",
                width: 110,
                key: "quantity2",
              },

            ]
          },
          datasColumns: [
            "序号",
            "字段名",
            "字段类型",
            "是否加密",
            "是否必填",
            "备注"
          ],
        },
        //资源分配的数据
        dataInfoChange: [],
        allDataInfo: [{
          resourceList: [],
          severList: [],
          datasList: [],
          toolList: []
        }],
        dataInfo: {
          resourceList: [],
          severList: [],
          datasList: [],
          toolList: []
        },
        processInfo: {}, //工单信息
        resourceInfo: {}, //待分配资源信息
        waitTasks: {}, //当前人员的等待处理信息
        applyValidate: {
          message: [{
            required: true,
            message: '请填写意见',
            trigger: 'change'
          }],
        },
        TaskNodes: { //工单进度
          count: 1, //完成数量
          list: []
        },
        title: "",
        isEdit: 0, //编辑状态
        processStartTime: 0,
        ipObject: [],
        vipObject: [],
        objList:[],
      }
    },
    created: function() {
      this.base()
    },

    methods: {
      selectExport(name) {
        if (name == '0') {
          this.$refs.apply.exportResource()
        } else if (name == '1') {
          this.$refs.apply.exportData()
        } else if (name == '2') {
          this.$refs.apply.exportAccount()
        }
      },
      selectAccountExport(name) {
        if (name == '0') {
          this.$refs.apply.exportAccount();
        } else if (name == '1') {
          this.$refs.apply.exportSevers();
        }
      },
      // 保存表单信息
      saveContent() {
        this.utils.delay(() => {
          if (this.processInfo.dispose == 1 && (this.isEdit == 1 || this.isEdit == 23) && !this.ifedit) {
            if (this.$refs.apply.validate()) {
              var handleInfo = {}
              this.$refs.apply.getHandleParams(handleInfo)

              handleInfo.message = ""
              handleInfo.reqId = this.reqId
              handleInfo.taskId = 0
              handleInfo.taskDefKey = 0

              var url = this.CONFIG.base_url_test + "/business-update"
              var that = this
              ajax.put({
                url: url,
                that: that,
                data: handleInfo,
                success: function() {
                  that.$Message.success("保存成功！");
                  that.ifedit = true
                }
              })
            }
          }
        }, 1000)
      },
      //保存注册表单
      saveRegister() {
        this.utils.delay(() => {
          if (this.processInfo.dispose == 1 && (this.isEdit == 1 || this.isEdit == 23) && !this.ifedit) {
            if (this.$refs.apply.validate()) {
              var handleInfo = {}
              this.$refs.apply.saveParams(handleInfo)

              // handleInfo.message = ""
              // handleInfo.reqId = this.reqId
              // handleInfo.taskId = 0
              // handleInfo.taskDefKey = 0
              var register = handleInfo.content.object;
              register.reqId = this.reqId;

              console.log("=====保存注册register=====");
              console.log(register);

              var url = this.CONFIG.url_know + "/update-register"
              var that = this
              ajax.post({
                url: url,
                that: that,
                data: register,
                success: function(data) {
                  if (data === -1) {
                    that.$Message.error({
                      content: "注册重复",
                      duration: 3
                    });
                  } else if (data == 1) {
                    that.$Message.success("保存成功！");
                    that.ifedit = true
                  } else {
                    that.$Message.success("系统错误");
                  }


                }
              })
            }
          }
        }, 1000)
      },
      // exportAccount() {
      // 	this.$refs.apply.exportAccount();
      // },
      setStepDomn(index) {
        this.TaskNodes.list[index].check ? this.TaskNodes.list[index].check = false : this.TaskNodes.list[index].check =
          true
        this.$forceUpdate();
      },
      base() {
        this.ifedit = true
        this.loadingSpinNumber = 1
        this.loadingSpin = true

        this.tabs = this.$store.state.tabs
        console.log("params----->>", this.params)
        // this.serviceType = this.params.serviceType
        this.reqId = this.params.reqId
        this.state = this.params.status
        this.taskId = this.params.taskId
        this.getProcessInfo() //获取工单详情
      },
      classify(arr, key) {
          let kind = []; //存放属性标识
          let newArr = []; //返回的数据
          arr.map((item) => {
              // 判断key是否存在，不存在则添加
              if (!kind.includes(item[key])) {
              kind.push(item[key]); //kind添加新标识
              newArr.push([]); //添加数组
              }
              let index = kind.indexOf(item[key]); //返回带有标识在kind内的下标，判断加入哪个数组
              newArr[index].push(item); //将对象存入数组
          });
          return newArr;
      },
      // 获取工单信息
      getProcessInfo() {
        var url = this.CONFIG.base_url_test + "/detail/" + this.reqId
        var param = {
          taskId: this.taskId
        }
        var that = this;
        ajax.get({
          url: url,
          that: that,
          params: param,
          success: function(data) {
            console.log("data-->", data)

            that.serviceType = data.serviceType
            that.isDelegate = data.isDelegate
            that.title = " / " + data.processName
            that.processStartTime = data.startTime

            data.waitTasks.forEach((item, index) => { //获取当前处理
              that.waitAllTaskKey.push(item.task_def_key)
              if (item.taskId == that.taskId) {
                that.isEdit = item.isEdit
                that.waitTaskKey = item.task_def_key
                that.taskDefKey = item.task_def_key
                if (that.title.indexOf(item.taskName) == -1) {
                  that.title += " / " + item.taskName
                }
                that.waitTasks = item
                console.log("that.waitTasks--------->", that.waitTasks, item)
                if (that.isDelegate === 1) { //被委派人员，只能完成任务
                  that.setOptions()
                }
                if (item.opOptions.indexOf("update") != -1 && data.isEdit != 1) {
                  data.isEdit = 1
                }
              }
            });
            if(data.waitTasks.length == 1){
              that.isEdit = data.waitTasks[0].isEdit
            }
            if (that.isEdit == 10 || that.serviceType === "accountNoBigdata" || that.serviceType ===
              "accountBigdata") {
              that.setAccountInfo(data);
            }
            if (that.serviceType === "vip") {
              that.ipObject = [];
              that.vipObject = [];

              data.content.forEach(item => {
                if (item.ipType == "" || item.ipType == "vip_service") {
                  that.ipObject.push(item);
                } else {
                  that.vipObject.push(item);
                }
              })
            }
                let sameType = [];
                //单次调用，输出二维数组
                sameType.push(that.classify(that.ipObject,"ipGroup"));
                that.objList = sameType[0]
                console.log('this.objList',that.objList)
                if (that.vipObject.length == 0) {
                    that.objList.forEach(item=>{
                        that.vipObject.push([])
                    })
                }

            //console.log("-------that.setAccountInfo(data)-----",data);
            that.processInfo = data
            that.loadingSpinNumber++
            that.setPageInfo()

            that.getResourceInfo()

            that.loadingSpinNumber--
          }
        })
      },
      //委派只允许yes
      setOptions() {
        var list = [];
        for (var i = 0; i < this.waitTasks.opOptions.length; i++) {
          if (this.waitTasks.opOptions[i].msgType != "delegate") {
            list.push(this.waitTasks.opOptions[i]);
          }
        }
        this.waitTasks.opOptions = list;
      },
      // 获取相关分配资源
      getResourceInfo() {
        var url = ""
        var that = this;
        var allIseditList = []
        this.processInfo.doneTasks.forEach(item => {
          allIseditList.push(item.isEdit)
        })
        this.processInfo.waitTasks.forEach(item => {
          allIseditList.push(item.isEdit)
        })
        console.log("allIseditList---->", allIseditList)
        if ((this.isEdit == 24 || this.serviceType == 'resource_resourceSon') || (this.isEdit == 21 || this.serviceType == 'resource_dataEtl')
          || (this.isEdit == 16 && this.serviceType == 'entry_v2') || this.isEdit == 20 || this.isEdit == 9 || this.serviceType == "resourceAllo" ||
          (this.serviceType == "resourceAllo" && that.taskDefKey && that.taskDefKey === '_3')) {
          var data = that.processInfo.content.resources
          that.resourceInfo = that.processInfo.content.resources
          data.forEach(item => {
            if(this.isEdit == 24 || this.serviceType == 'resource_resourceSon' || this.isEdit == 21 || this.serviceType == 'resource_dataEtl'){ //v2工单子流程
              item.check = true

              if (item.resourcetype == 4) {
                item.quotaValue = JSON.parse(item.val)
                item.val = JSON.parse(item.val)
              } else if (item.resourcetype == 0 || item.resourcetype == 5 || item.resourcetype == 6) {
                item.quotaValue = parseFloat(item.val)
                item.val = parseFloat(item.val)
                item.quotaUnit = item.unit
              } else {
                item.quotaValue = item.val
                item.quotaUnit = item.unit
              }
              if(!item.taskQuantity || item.taskQuantity == 0){
                item.taskQuantity = item.val
              }
              item.waitQuantity = item.taskQuantity
              item.doingQuantity = 0
              item.doneQuantity = 0
              item.quantity2 = JSON.parse(JSON.stringify(item.quantity))
              if (!item.quantity || item.quantity == 0) {
                item.quantity = item.val
              }

            }else{ //历史工单

              item.check = true
              item.waitQuantity = item.taskQuantity
              item.doingQuantity = 0
              item.doneQuantity = 0
              if (item.quantity == undefined || item.quantity == null) {
                item.quantity = 0
              }
              if (item.resourcetype == 4) {
                item.quotaValue = JSON.parse(item.val)
                item.val = JSON.parse(item.val)
              } else if (item.resourcetype == 0 || item.resourcetype == 5 || item.resourcetype == 6) {
                item.quotaValue = parseFloat(item.val)
                item.val = parseFloat(item.val)
                item.quotaUnit = item.unit
              } else {
                item.quotaValue = item.val
                item.quotaUnit = item.unit
              }
            }
          })
          that.dataInfo.resourceList = data

          var tool = that.processInfo.content.tools
          tool.forEach(t => {
            t.check = true
            if (t.resourceProgress && t.resourceProgress.length > 0) {
              t.resourceProgress.forEach(item => {
                item.check = true
                if (item.resourcetype == 4) {
                  item.quotaValue = JSON.parse(item.val)
                  item.val = JSON.parse(item.val)
                } else if (item.resourcetype == 0 || item.resourcetype == 5 || item.resourcetype == 6) {
                  item.quotaValue = parseFloat(item.val)
                  item.val = parseFloat(item.val)
                  item.quotaUnit = item.unit
                } else {
                  item.quotaValue = item.val
                  item.quotaUnit = item.unit
                }
                item.quantity = item.quotaValue
              })
            }
          })
          that.dataInfo.toolList = tool
          console.log("-----dataInfo------>", that.dataInfo.toolList)

          var severList = that.processInfo.content.severs
          severList.forEach(item => {
            item.check = true
            item.quantitys = item.taskQuantity
            item.waitQuantity = item.taskQuantity
            item.doingQuantity = 0
            item.doneQuantity = 0
          })
          that.dataInfo.severList = severList

        } else if (this.serviceType === 'entry' || this.serviceType === 'entry_v2') {
          console.log("allIseditList----2->", allIseditList, allIseditList.indexOf(16))
          if (allIseditList.indexOf(5) > -1 || allIseditList.indexOf(6) > -1) {
            url = this.CONFIG.progress_url + "/allocation/progress/resource/" + this.reqId
            if (url != "") {
              that.loadingSpinNumber++
              ajax.get({
                url: url,
                that: that,
                params: null,
                success: function(data) {
                  if (that.isEdit == 5) {
                    that.resourceInfo = data
                  }
                  that.hanldeResource(data)
                  that.dataInfo.resourceList = data
                  that.loadingSpinNumber--
                }
              })
            }
          }
          if (allIseditList.indexOf(15) > -1 || (that.taskDefKey != undefined && (that.taskDefKey === '_09data' || that
              .taskDefKey ===
              '_10'))) {
            url = this.CONFIG.progress_url + "/allocation/progress/data/" + this.reqId
            if (url != "") {
              that.loadingSpinNumber++
              ajax.get({
                url: url,
                that: that,
                params: null,
                success: function(data) {
                  if (that.isEdit == 15) {
                    that.resourceInfo = data
                  }
                  that.dataInfo.datasList = data
                  that.loadingSpinNumber--
                }
              })
            }
          }
          if (allIseditList.indexOf(7) > -1 || allIseditList.indexOf(8) > -1 || (that.taskDefKey != undefined && (that.taskDefKey ===
              '_15sontool' || that.taskDefKey === '_16'))) {
            url = this.CONFIG.progress_url + "/allocation/progress/tool/" + this.reqId
            if (url != "") {
              that.loadingSpinNumber++
              ajax.get({
                url: url,
                that: that,
                params: null,
                success: function(data) {
                  if (that.isEdit == 7) {
                    that.resourceInfo = data
                  }
                  that.handleTool(data)
                  that.dataInfo.toolList = data
                  that.loadingSpinNumber--
                }
              })
            }
          }
          // 16为资源工具分配阶段;17:资源分配结果核对节点
          if (allIseditList.indexOf(16) > -1 || allIseditList.indexOf(17) > -1) {
            url = this.CONFIG.progress_url + "/allocation/progress/task/" + this.reqId
            that.loadingSpinNumber++
            console.log("url===========>>>>> ", url, that.isEdit)
            ajax.get({
              url: url,
              that: that,
              params: null,
              success: function(data) {
                data.forEach(roceList => {
                  console.log("roceLis==>", roceList)
                  that.$set(roceList, "toolList", roceList.tools)
                  that.$set(roceList, "resourceList", roceList.resources)
                  if (roceList.resources.length > 0) {
                    that.hanldeResource(roceList.resources)
                  }
                  if (roceList.tools.length > 0) {
                    that.handleTool(roceList.tools)
                  }
                  if (roceList.taskId == that.taskId) {
                    that.resourceInfo = roceList
                  }
                  if (that.isEdit == 17) {
                    console.log("item.resources--->", that.isEdit == 17)
                    that.allDataInfo[0].resourceList = that.allDataInfo[0].resourceList.concat(roceList.resources)
                    that.allDataInfo[0].toolList = that.allDataInfo[0].toolList.concat(roceList.tools)
                  }
                })

                that.dataInfoChange = data
                that.loadingSpinNumber--
              }
            })
          }
        } else if (this.serviceType === 'severMachine' && allIseditList.indexOf(13) > -1) {
          url = this.CONFIG.progress_url + "/allocation/progress/sever/" + this.reqId
          if (url != "") {
            that.loadingSpinNumber++
            ajax.get({
              url: url,
              that: that,
              params: null,
              success: function(data) {
                data.forEach(item => {
                  item.check = true
                  item.quantitys = item.waitQuantity
                })
                that.resourceInfo = data
                that.dataInfo.severList = data
                that.loadingSpinNumber--
              }
            })
          }
        }
      },
      // 处理资源相关信息
      hanldeResource(data) {
        data.forEach(item => {
          if (item.waitQuantity != 0) {
            item.check = true
          }
          if (item.quantity == undefined) {
            item.quantity = item.waitQuantity
          }
          if (item.resourcetype == 4) {
            item.quotaValue = JSON.parse(item.val)
            item.val = JSON.parse(item.val)
          } else {
            item.quotaValue = item.val
            item.quotaUnit = item.unit
          }
        })
      },
      handleTool(data) {
        data.forEach(t => {
          if (t.waitQuantity != 0) {
            t.check = true
          }
          t.resourceProgress.forEach(item => {
            if (item.resourcetype == 4) {
              item.quotaValue = JSON.parse(item.val)
              item.val = JSON.parse(item.val)
            } else {
              item.quotaValue = item.val
              item.quotaUnit = item.unit
            }
          })
        })
      },

      //设置等待处理进度条信息
      setWaitTask() {
        this.doneAllTaskKey = []
        console.log("item ---->", this.processInfo.waitTasks, this.TaskNodes.list)
        this.processInfo.doneTasks.forEach(item => {
          this.doneAllTaskKey.push(item.task_def_key)
        })
        this.loadingSpinNumber--
      },

      //设置显示的基本信息页面
      setPageInfo() {
        console.log("setPageInfo--->", this.reqId, this.state, this.serviceType)
        this.infoPage = 'netmap'
        if(this.serviceType === 'entry_v2'){
          this.infoPage = "settLedInInfo_v2"
        }else if (this.serviceType === 'entry') {
          this.infoPage = "settLedInInfo"
        } else if (this.serviceType === 'net') {
          this.infoPage = "network"
        } else if (this.serviceType === 'accountNoBigdata' || this.serviceType === 'accountBigdata') {
          console.log("===processStartTime====", this.processStartTime);
          if (this.processStartTime > 1598529600) {
            this.infoPage = 'accountApply'
          } else {
            this.infoPage = 'accountApply_old'
          }

        } else if (this.serviceType == 'resource_resourceServer' || this.serviceType === 'resourceAllo' || this.serviceType === 'resource_resourceSon'
          || this.serviceType === 'resource_openApiPlatform' || this.serviceType === 'resource_dataEtl') {
          this.infoPage = 'childrenResource'
        } else if (this.serviceType === 'severMachine') { //租户物理机申请
          this.infoPage = 'serverApply'
        } else if (this.serviceType === 'severPlantform') { //平台物理机申请
          this.infoPage = 'serverPlatformApply'
        } else if (this.serviceType === 'securityCheck') { //安全申请
          this.infoPage = 'safe_apply'
        } else if (this.serviceType == 'sonAccountAllo' || this.serviceType === 'sonAccountCancel') {
          this.infoPage = 'sonAccountAllo'
        } else if (this.serviceType == 'loadBalance') { //负载均衡
          this.infoPage = 'loadbalancing'
        } else if (this.serviceType == 'hightAuthoritys') { //最高权限
          this.infoPage = 'sysauthority'
        } else if (this.serviceType === 'accountCancel') { //销户
          this.infoPage = 'apply_accountCancel'
        } else if (this.serviceType === 'register') { //注册
          this.infoPage = 'register'
        } else if (this.serviceType === 'vip') {
          this.infoPage = 'vip'
        } else if (this.serviceType === 'addGold') {
          this.infoPage = 'addGold'
        } else if (this.serviceType === 'netmapping') {
          this.infoPage = 'netmap'
        } else if (this.serviceType === 'opinion') {
          this.infoPage = 'applysuggest'
        } else if (this.serviceType === 'shrinkage') {
          this.infoPage = 'shrinkage'
        } else if (this.serviceType === 'noRealAccount') {
          this.infoPage = 'noRealAccount'
        }else {
          this.infoPage = "children"
        }
        this.getTaskNodes()
      },

      //获取工单进度
      getTaskNodes() {
        this.TaskNodes.count = 1
        var url = this.CONFIG.base_url_test + "/task-nodes/" + this.reqId
        var that = this;
        ajax.get({
          url: url,
          that: that,
          params: null,
          success: function(data) {
            that.TaskNodes.list = data
            data.forEach(item => {
              if (item.status == 1) {
                that.TaskNodes.count++
              }
            });
            that.setWaitTask()
          }
        })
      },
      closeHandlePage() { //关闭页面
        var index = -1;
        this.tabs.list.some((item, i) => {
          if (item.tabKey === this.tabs.tabsPage) {
            index = i
            return true
          }
        })
        var isLast = false //判断是否操作上一步页面
        this.tabs.list.some((item, i) => {
          if (item.tabKey === this.tabs.lastPage) {
            isLast = true
            return true
          }
        })
        this.tabs.isEdit = ""
        if (isLast && this.tabs.lastPage != "") {
          this.tabs.tabsPage = this.tabs.lastPage
          this.tabs.lastPage = ""
        } else {
          this.tabs.tabsPage = this.tabs.list[index - 1].tabKey
        }
        this.tabs.list.splice(index, 1)
        console.log("this.tabs----------->>>>>", this.tabs)
        this.$store.commit("tabs", this.tabs);
      },
      toShowChildrenList() {
        if (this.waitTasks.isEdit == 10 || this.waitTasks.isEdit == 14) {
          if (this.$refs.handelModal.ifNoToChildren()) {
            this.$Notice.success({
              title: '提示',
              desc: '所有账号已分配子流程或已处理，无需再发起子流程!',
              duration: 10
            });
          } else {
            this.showChildrenList = true;
          }
        } else {
          this.showChildrenList = true;
        }
      },
      //发起子工单
      toChildrenPage(temp) {
        if (temp.serviceType == 'resourceAllo') {
          console.log("--->", this.resourceInfo)
          if (this.isEdit == 16 && this.utils.listIsEmpty(this.resourceInfo.resourceList)
            && this.utils.listIsEmpty(this.resourceInfo.toolList)) {
            this.$Message.error('暂无可分配资源！无法发起该子工单');
          } else if (this.resourceInfo.length == 0) {
            this.$Message.error('暂无可分配资源！无法发起该子工单');
          } else {
            var t = false
            if (this.isEdit == 16) {
              this.resourceInfo.resourceList.some(item => {
                if (item.waitQuantity != 0) {
                  t = true
                  return true
                }
              })
              this.resourceInfo.toolList.some(item => {
                if (item.waitQuantity != 0) {
                  t = true
                  return true
                }
              })
            } else {
              this.resourceInfo.some(item => {
                if (item.waitQuantity != 0) {
                  t = true
                  return true
                }
              })
            }
            if (t) {
              var isName = false //是否已经存在标签
              this.tabs.list.some(item => {
                if (item.tabKey === temp.serviceType + this.taskDefKey) {
                  isName = true
                  return
                }
              })
              if (!isName) {
                this.tabs.list.push({
                  title: "创建子工单 / " + temp.name,
                  key: "apply",
                  tabKey: temp.serviceType + this.taskDefKey,
                  params: {
                    reqId: this.reqId,
                    taskId: this.waitTasks.taskId,
                    serviceType: temp.serviceType,
                    processInsId: this.waitTasks.processInsId,
                    depname: temp.name,
                    taskDefKey: this.taskDefKey,
                    resourceInfo: this.resourceInfo,
                    isEdit: this.waitTasks.isEdit
                  }
                })
              }
              this.tabs.lastPage = this.tabs.tabsPage
              this.tabs.tabsPage = temp.serviceType + this.taskDefKey
              this.showChildrenList = false
              this.$store.commit("tabs", this.tabs);
            } else {
              this.$Message.error('资源已分配完成！无法发起该子工单');
            }
          }
        } else {
          console.log("11111--->", this.account)
          var isName = false //是否已经存在标签
          this.tabs.list.some(item => {
            if (item.tabKey === temp.serviceType + this.taskDefKey) {
              isName = true
              return
            }
          })
          if (!isName) {
            var projectId = -1
            if (!this.utils.objectIsEmpty(this.processInfo.base.project) && !this.utils.objectIsEmpty(this.processInfo.base
                .project
                .id)) {
              projectId = this.processInfo.base.project.id
            }
            this.tabs.list.push({
              title: "创建子工单 / " + temp.name,
              key: "apply",
              tabKey: temp.serviceType + this.taskDefKey,
              params: {
                reqId: this.reqId,
                taskId: this.waitTasks.taskId,
                serviceType: temp.serviceType,
                processInsId: this.waitTasks.processInsId,
                depname: temp.name,
                taskDefKey: this.taskDefKey,
                resourceInfo: this.resourceInfo,
                accountInfo: this.$refs.handelModal.getSonAccount(),
                projectId: projectId
              }
            })
          }
          this.tabs.lastPage = this.tabs.tabsPage
          this.tabs.tabsPage = temp.serviceType + this.taskDefKey
          this.showChildrenList = false
          this.$store.commit("tabs", this.tabs);

        }
      },
      //查看子工单详情
      sonsInfo(row, index) {
        console.log("row---->", row)
        console.log(this.waitTasks)
        var isName = false //是否已经存在标签
        this.tabs.list.some(item => {
          if (item.tabKey === row.reqId + '') {
            isName = true
            return
          }
        })
        if (!isName) {
          this.tabs.list.push({
            title: "子工单详情 / " + row.processName,
            key: "handle",
            tabKey: row.reqId + '',
            params: {
              reqId: row.reqId,
              state: row.status,
              taskDefKey: row.task_def_key
            }
          })
        }
        this.tabs.lastPage = this.tabs.tabsPage
        this.tabs.tabsPage = row.reqId + ''
        // console.log("tabs ------->>>>>", this.tabs)
        this.$store.commit("tabs", this.tabs);
      },
      //设置滚动条位置
      toScroll(value) {
        var temp = document.getElementsByName(value)
        if (temp.length > 0) {
          var item = temp[temp.length - 1].offsetTop
          // console.log(value,item)
          this.$refs.base.scrollTop = item - document.getElementById("baseinfo").offsetTop
        }
      },
      toParent() {
        var isName = false //是否已经存在标签
        this.tabs.list.some(item => {
          if (item.tabKey === this.processInfo.parentReqId + '') {
            isName = true
            return
          }
        })
        if (!isName) {
          this.tabs.list.push({
            title: "主工单",
            key: "handle",
            tabKey: this.processInfo.parentReqId + '',
            params: {
              reqId: this.processInfo.parentReqId,
              state: this.processInfo.status,
            }
          })
        }
        this.tabs.lastPage = this.tabs.tabsPage
        this.tabs.tabsPage = this.processInfo.parentReqId + ''
        this.$store.commit("tabs", this.tabs);
      },
      showHandlePage() {
        var isHandle = false
        var temp = false
        var offsetName = this.waitTasks.taskName
        //this.waitTasks = this.processInfo.waitTasks[0]
        console.log("--------", this.waitTasks)
        if (this.waitTasks.sons.length > 0) {
          this.waitTasks.sons.some(item => {
            if (item.status == 1 || item.status == 3) { //进行中和，退回状态
              temp = true
              return true
            }
          })
        }
        if (temp) {
          this.toScroll(offsetName)
          this.$Message.error("当前还有未处理的子工单，不可处理主工单!")
        } else {
          if (!this.ifedit) {
            // console.log("===========", this.$refs.apply.validate());
            if (this.$refs.apply.validate()) {
              this.showHandle = true
            }
          } else {
            console.log("----2---->", this.isEdit, this.serviceType)
            if (this.isEdit == 16 && this.serviceType == "resourceAllo") {
              this.dataInfo.resourceList.forEach(item => {
                item.quantity = item.waitQuantity
              })
              this.dataInfo.severList.forEach(item => {
                this.$set(item, "quantitys", item.waitQuantity)
              })
            }
            this.showHandle = true
          }
        }

      },

      //前往编辑
      editStatus() {
        this.utils.delay(() => {
          var temp = false
          // if (this.waitTasks.sons != undefined && this.waitTasks.sons != null && this.waitTasks.sons.length > 0) {
          // 	this.waitTasks.sons.some(item => {
          // 		if (item.status != 0) { //进行中和，退回状态
          // 			temp = true
          // 			return true
          // 		}
          // 	})
          // }
          // if (temp) {
          // 	this.$Message.error("当前已发起相关子工单，暂不可编辑!")
          // } else {
          if (!this.ifedit) {
            this.ifedit = true
          } else {
            this.ifedit = false
          }
          this.updateComponents = new Date().getTime()
          this.$refs.base.scrollTop = 0
          // this.$refs.apply.stepTitleId = 1
          // }
        }, 1000)
      },

      // 导出网络策略表单
      downLoadNetwork() {
        console.log(this.$refs.apply.processInfo.reqSubject)
        var fn = this.$refs.apply.processInfo.reqSubject + '.xls'
        this.loadingdownLoadNetwork = true
        var url = this.CONFIG.progress_url + '/net-file/' + this.params.reqId
        var that = this
        Axios.get(url, {
            responseType: 'blob'
          })
          .then(function(response) {
            var headers = response.headers['content-disposition']
            var fileName = headers.substring(headers.indexOf("=") + 1, headers.length).trim()
            console.log(fileName)
            var blob = new Blob([response.data])
            var downloadElement = document.createElement('a');
            var href = window.URL.createObjectURL(blob); //创建下载的链接
            downloadElement.href = href;

            // downloadElement.download = fileName
            downloadElement.download = fn
            document.body.appendChild(downloadElement);
            downloadElement.click(); //点击下载
            document.body.removeChild(downloadElement); //下载完成移除元素
            window.URL.revokeObjectURL(href); //释放掉blob对象
            that.loadingdownLoadNetwork = false
          }).catch(function(error) {
            if (error && error.response) {
              if (error.response.status == 403) { //forbiden
                that.$Notice.error({
                  title: '请求拒绝',
                  desc: '您没有当前操作权限',
                });
              } else if (error.response.status == 401) { //forbiden
                that.$Notice.error({
                  title: '用户未登陆',
                  desc: '请重新登陆该系统',
                });
              } else if (error.response.status == 400) { //forbiden
                that.$Notice.error({
                  title: '访问数据不存在',
                  desc: '请联系管理员进行处理',
                });
              } else if (error.response.status == 406) { //forbiden
                that.$Notice.error({
                  title: '访问数据不存在',
                  desc: error.data,
                  duration: 5,
                });
              } else {
                that.$Notice.error({
                  title: '网络异常',
                  desc: '请联系管理员进行处理',
                });
              }
            } else if (error == 400) {
              that.$Notice.warning({
                title: '访问数据不存在',
                desc: '请联系管理员进行处理',
              });
            } else if (error == 403) { //forbiden
              that.$Notice.error({
                title: '请求拒绝',
                desc: '您没有当前操作权限',

              });
            } else if (error == 404) {
              that.$Notice.error({
                title: '访问数据有误',
                desc: '请联系管理员进行处理',
              });
            } else if (error == 401) { //forbiden
              that.$Notice.error({
                title: '用户未登陆',
                desc: '请重新登陆该系统',
              });
            } else if (error == 406) { //forbiden
              that.$Notice.error({
                title: '访问数据不存在',
                desc: "请先配置审批节点审批人信息",
                duration: 5,
              });
            } else {
              that.$Notice.error({
                title: '网络异常',
                desc: '请联系管理员进行处理',
              });
            }
            that.loadingdownLoadNetwork = false
          });
      },

      formatDate(value) {
        var date = new Date(value * 1000);
        var year = date.getFullYear();
        var month = this.padDate(date.getMonth() + 1);
        var day = this.padDate(date.getDate());
        var hours = this.padDate(date.getHours());
        var minutes = this.padDate(date.getMinutes());
        var seconds = this.padDate(date.getSeconds());
        return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
      },
      padDate(value) {
        return value < 10 ? '0' + value : value;
      },

      formatTime(value) {
        return this.utils.formatDate(new Date(value), "yyyy-MM-dd hh:mm")
      },
      setAccountInfo(data) {
        //console.log("------data------",data);
        var content = data.content;
        if (content != null && content != undefined) {
          if (content.people != null && content.people != undefined) {
            for (var i = 0; i < content.people.length; i++) {
              content.people[i].selectTypes = [];

              if (content.people[i].isExpand == undefined) {
                content.people[i].isExpand = -1;
              }
              if (content.people[i].date == undefined) {
                var time = content.people[i].deadline * 1000;
                content.people[i].date = this.utils.formatDate(new Date(time), "yyyy-MM-dd");
              }
              if (content.people[i].isSever == undefined) {
                if (content.people[i].severs != null) {
                  if (content.people[i].severs.length > 0) {
                    content.people[i].isSever = true;
                    content.people[i].selectTypes.push("主机账号");
                  } else {
                    content.people[i].isSever = false;
                  }
                } else {
                  content.people[i].isSever = false;
                }
              }
              if (content.people[i].isDb == undefined) {
                if (content.people[i].dbs != null) {
                  if (content.people[i].dbs.length > 0) {
                    content.people[i].isDb = true;
                    content.people[i].selectTypes.push("数据库账号");
                  } else {
                    content.people[i].isDb = false;
                  }
                } else {
                  content.people[i].isDb = false;
                }
              }
              if (content.people[i].isHadoop == undefined) {
                if (content.people[i].hadoops != null) {
                  if (content.people[i].hadoops.length > 0) {
                    content.people[i].isHadoop = true;
                    content.people[i].selectTypes.push("Hadoop账号");
                  } else {
                    content.people[i].isHadoop = false;
                  }
                } else {
                  content.people[i].isHadoop = false;
                }
              }
              if (content.people[i].isHftp == undefined) {
                if (content.people[i].hftps != null) {
                  if (content.people[i].hftps.length > 0) {
                    content.people[i].isHftp = true;
                    content.people[i].selectTypes.push("UAP账号");
                  } else {
                    content.people[i].isHftp = false;
                  }
                } else {
                  content.people[i].isHftp = false;
                }
              }
              if (content.people[i].isPaas == undefined) {
                if (content.people[i].paas != null) {
                  if (content.people[i].paas.length > 0) {
                    content.people[i].isPaas = true;
                    content.people[i].selectTypes.push("PaaS门户账号");
                  } else {
                    content.people[i].isPaas = false;
                  }
                } else {
                  content.people[i].isPaas = false;
                }
              }
              if (content.people[i].isDacp == undefined) {
                if (content.people[i].dacps != null) {
                  if (content.people[i].dacps.length > 0) {
                    content.people[i].isDacp = true;
                    content.people[i].selectTypes.push("DACP账号");
                  } else {
                    content.people[i].isDacp = false;
                  }
                } else {
                  content.people[i].isDacp = false;
                }
              }
              if (content.people[i].isElse == undefined) {
                if (content.people[i].elseAuthes != null) {
                  if (content.people[i].elseAuthes.length > 0) {
                    content.people[i].isElse = true;
                    content.people[i].selectTypes.push("其他权限内容");
                  } else {
                    content.people[i].isElse = false;
                  }
                } else {
                  content.people[i].isElse = false;
                }
              }
            }
          }
        }
      }
    },
    computed: {
      tabsInfo() {
        if (this.$store.state.tabs != undefined && this.$store.state.tabs != null) {
          return this.$store.state.tabs.tabsPage
        } else {
          return ""
        }
      },
      number() {
        return this.loadingSpinNumber
      }

    },
    watch: {
      tabsInfo(newVal, oldVal) {
        console.log("newVal,oldVal-->", newVal, oldVal, this.params.taskId)
        if (this.params.taskId != undefined && this.params.taskId != null) {
          if (newVal === (this.params.reqId + this.params.taskId)) {
            this.tabs.isEdit = ""
            this.$store.commit("tabs", this.tabs);
            this.base()
          }
        } else {
          if (newVal === this.params.reqId + '') {
            this.tabs.isEdit = ""
            this.$store.commit("tabs", this.tabs);
            this.base()
          }
        }
      },
      number(newVal, oldVal) {
        console.log("加载------------->", newVal, oldVal)
        if (newVal == 0) {
          this.loadingSpin = false
        }
      },
      ifedit(newVal, oldVal) {
        if (newVal && !oldVal) {
          this.base()
        }
      }
    },

    props: {
      params: {}
    }
  }
</script>
